# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=archlinux-appstream-data
pkgver=20231010
pkgrel=1
pkgdesc='Arch Linux application database for AppStream-based software centers'
arch=(any)
url='https://www.archlinux.org'
license=(GPL)
depends=()
makedepends=()
source=()
noextract=()
for _repo in core extra multilib; do
 source+=($_repo-$pkgver.xml.gz::https://sources.archlinux.org/other/packages/$pkgname/$pkgver/$_repo/Components-x86_64.xml.gz
          $_repo-icons-48x48-$pkgver.tar.gz::https://sources.archlinux.org/other/packages/$pkgname/$pkgver/$_repo/icons-48x48.tar.gz
          $_repo-icons-64x64-$pkgver.tar.gz::https://sources.archlinux.org/other/packages/$pkgname/$pkgver/$_repo/icons-64x64.tar.gz
          $_repo-icons-128x128-$pkgver.tar.gz::https://sources.archlinux.org/other/packages/$pkgname/$pkgver/$_repo/icons-128x128.tar.gz)
 noextract+=($_repo.xml.gz-$pkgver $_repo-icons-{48x48,64x64,128x128}-$pkgver.tar.gz)
done
sha256sums=('8fd4a96dc3c3e07adfafffcd2b0f8ca3aea5fb44411a5bba54c97bd1aa3d13db'
            '7989bb311baa38ef545250282aa065d23281c46dfb8faabe4c653487bdbded5c'
            '3a0aa0ba145932d6a450f79f91983112a2744a2ce2aa606da1ba846824fd0db9'
            '7989bb311baa38ef545250282aa065d23281c46dfb8faabe4c653487bdbded5c'
            '129015c80eb03bfa418c3a922b857f50def685479370fae22b510edc655654bb'
            '7279b27e3b2503289b1f082b6eb66b66bb887894dd3ab07cda409f66fcfa561a'
            '9a4c9f433545d391ce0dc669a6eb6c8862cbd2e963bea8c3ef29fca01b0bf536'
            'd6378d5bfde9c4869864ee7044600596f90476915212ec7a126264b5f2d2d6ef'
            '3b240b008f6a7f4cf696e0fb70754f1964d10711561e76e055c2f37981ad4e12'
            '8255b777eb36e6142d9485db0da9f400986b55dd75d4e70d64d0432ddc167af1'
            'be40299af83eecd3f9b9b1f4d8166508be05986b90951fc62e5c66252aada3c7'
            '475c7388a71a9ede23b7ff0e5bd78aa61c56166246755955c0c1d82b3d528c72')

package() {
  mkdir -p "$pkgdir"/usr/share/swcatalog/{icons/archlinux-arch-{core,extra,multilib}/{48x48,64x64,128x128},xml}
  for _repo in core extra multilib; do
   tar -xzf $_repo-icons-48x48-$pkgver.tar.gz -C "$pkgdir"/usr/share/swcatalog/icons/archlinux-arch-$_repo/48x48
   tar -xzf $_repo-icons-64x64-$pkgver.tar.gz -C "$pkgdir"/usr/share/swcatalog/icons/archlinux-arch-$_repo/64x64
   tar -xzf $_repo-icons-128x128-$pkgver.tar.gz -C "$pkgdir"/usr/share/swcatalog/icons/archlinux-arch-$_repo/128x128
   install -m644 $_repo-$pkgver.xml.gz "$pkgdir"/usr/share/swcatalog/xml/$_repo.xml.gz
  done
}
